package com.bawei.module_shop.address.adapter;

import android.view.View;
import android.widget.CheckBox;

import com.bawei.library_base.room.address.Address;
import com.bawei.module_shop.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * @author : zhiyu
 * @date : 2021/12/22
 * @content :
 */
public class AddressAdapter extends BaseQuickAdapter<Address, BaseViewHolder> {
    public AddressAdapter(@Nullable List<Address> data) {
        super(R.layout.item_address, data);
        addChildClickViewIds(R.id.address_delete);
        addChildClickViewIds(R.id.address_check);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, Address address) {
        baseViewHolder.setText(R.id.address_name,address.getName());
        baseViewHolder.setText(R.id.address_phone,address.getPhone());
        baseViewHolder.setText(R.id.address_dizhi,address.getFrom());



        CheckBox checkBox = baseViewHolder.getView(R.id.address_check);
        if (address.isIstrue()){
            checkBox.setChecked(true);
        }else {
            checkBox.setChecked(false);
        }


    }
}
